<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta charset="utf-8"/>
    <title>新增</title>
    <meta name="description" content="Restyling jQuery UI Widgets and Elements"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
    <link rel="stylesheet" th:href="@{{path}/css/bootstrap.min.css(path=${contextPath})}"/>
    <link rel="stylesheet" th:href="@{{path}/css/font-awesome.min.css(path=${contextPath})}"/>

    <link rel="stylesheet" th:href="@{{path}/css/jquery-ui.custom.min.css(path=${contextPath})}"/>
    <link rel="stylesheet" th:href="@{{path}/css/chosen.css(path=${contextPath})}"/>
    <link rel="stylesheet" th:href="@{{path}/css/datepicker.css(path=${contextPath})}"/>
    <link rel="stylesheet" th:href="@{{path}/css/bootstrap-timepicker.css(path=${contextPath})}"/>
    <link rel="stylesheet" th:href="@{{path}/css/daterangepicker.css(path=${contextPath})}"/>
    <link rel="stylesheet" th:href="@{{path}/css/bootstrap-datetimepicker.css(path=${contextPath})}"/>
    <link rel="stylesheet" th:href="@{{path}/css/colorpicker.css(path=${contextPath})}"/>

    <link rel="stylesheet" th:href="@{{path}/css/ace-fonts.css(path=${contextPath})}"/>
    <link rel="stylesheet" th:href="@{{path}/css/ace.min.css(path=${contextPath})}" id="main-ace-style"/>
    <!--[if lte IE 9]>
    <link rel="stylesheet" th:href="@{{path}/css/ace-part2.min.css(path=${contextPath})}"/>
    <![endif]-->
    <!--[if lte IE 9]>
    <link rel="stylesheet" th:href="@{{path}/css/ace-ie.min.css(path=${contextPath})}"/>
    <![endif]-->
    <script th:src="@{{path}/js/ace-extra.min.js(path=${contextPath})}"></script>
    <!--[if lte IE 8]>
    <script th:src="@{{path}/js/html5shiv.min.js(path=${contextPath})}"></script>
    <script th:src="@{{path}/js/respond.min.js(path=${contextPath})}"></script>
    <![endif]-->
</head>

<body class="no-skin">
<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
    <!-- /section:basics/sidebar -->
    <div class="main-content">
        <div class="breadcrumbs" id="breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="ace-icon fa fa-home home-icon"></i>
                    <a th:href="@{{path}/manager/homepage(path=${contextPath})}">首页</a>
                </li>
                <li>
                    <a th:href="@{{path}/manager/activity/list(path=${contextPath})}">专题活动</a>
                </li>
                <li>
                    <a th:href="@{{path}/manager/activity/add(path=${contextPath})}">新增</a>
                </li>
            </ul><!-- /.breadcrumb -->

        </div>

        <!-- /section:basics/content.breadcrumbs -->
        <div class="page-content">

            <div class="page-content-area">

                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <form class="form-horizontal" role="form">
                            <!-- #section:elements.form -->
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="menu"> 菜单名称：</label>

                                <div class="col-sm-9">
                                    <input type="text" id="menu" placeholder="输入菜单名称"
                                           class="col-xs-10 col-sm-5"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="title"> 标题：</label>

                                <div class="col-sm-9">
                                    <input type="text" id="title" placeholder="输入标题"
                                           class="col-xs-10 col-sm-5"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label no-padding-right" for="sort"> 优先级：</label>

                                <div class="col-sm-9">
                                    <input type="text" id="sort" placeholder="输入优先级"
                                           class="col-xs-10 col-sm-5"/>
                                </div>
                            </div>

                            <!-- /section:elements.form -->
                            <div class="space-4"></div>

                            <div>

                                <!--<div class="wysiwyg-editor" id="editor1"></div>-->
                                <div id="editor">
                                </div>

                                <!-- 注意， 只需要引用 JS，无需引用任何 CSS ！！！-->
                                <script type="text/javascript"
                                        th:src="@{{path}/js/wangEditor.min.js(path=${contextPath})}"></script>
                                <script type="text/javascript" th:inline="javascript">
                                    /*<![CDATA[*/
                                    contextPath = /*[[@{/}]]*/ '';
                                    /*]]>*/
                                    var E = window.wangEditor
                                    var editor = new E('#editor')
                                    // 配置服务器端地址
                                    editor.customConfig.uploadImgServer = contextPath + 'file/uploadImg?wangeditor_debug_mode=1'
                                    // 自定义filename
                                    editor.customConfig.uploadFileName = 'file'
                                    // 限制图片大小
                                    editor.customConfig.uploadImgMaxSize = 20 * 1024 * 1024
                                    // 限制一次最多上传图片数
                                    editor.customConfig.uploadImgMaxLength = 1
                                    // 超时时间
                                    editor.customConfig.uploadImgTimeout = 5000
                                    // 错误提示
                                    editor.customConfig.customAlert = function (info) {
                                        alert(info)
                                    }
                                    editor.create()
                                </script>
                            </div>

                            <div class="clearfix form-actions">
                                <div class="col-md-offset-3 col-md-9">
                                    <button class="btn btn-info" type="button" id="submit">
                                        <i class="ace-icon fa fa-check bigger-110"></i>
                                        立即提交
                                    </button>

                                    &nbsp; &nbsp; &nbsp;
                                    <button class="btn" type="reset">
                                        <i class="ace-icon fa fa-undo bigger-110"></i>
                                        重置
                                    </button>
                                </div>
                            </div>

                            <div class="hr hr-24"></div>

                        </form>

                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content-area -->
        </div><!-- /.page-content -->
    </div><!-- /.main-content -->

</div><!-- /.main-container -->

<!--[if !IE]> -->
<script th:src="@{{path}/js/jquery.min.js(path=${contextPath})}"></script>
<!-- <![endif]-->

<!--[if !IE]> -->
<script th:src="@{{path}/js/jquery.min.js(path=${contextPath})}"></script>
<!-- <![endif]-->

<!--[if IE]>
<script th:src="@{{path}/js/jquery1x.min.js(path=${contextPath})}"></script>
<![endif]-->
<script th:src="@{{path}/js/jquery.mobile.custom.min.js(path=${contextPath})}"></script>
<script th:src="@{{path}/js/bootstrap.min.js(path=${contextPath})}"></script>

<!-- page specific plugin scripts -->
<script th:src="@{{path}/js/jquery-ui.custom.min.js(path=${contextPath})}"></script>
<script th:src="@{{path}/js/jquery.ui.touch-punch.min.js(path=${contextPath})}"></script>
<script th:src="@{{path}/js/jquery.hotkeys.min.js(path=${contextPath})}"></script>
<script th:src="@{{path}/js/bootstrap-wysiwyg.min.js(path=${contextPath})}"></script>
<script th:src="@{{path}/js/bootbox.min.js(path=${contextPath})}"></script>

<!-- ace scripts -->
<script th:src="@{{path}/js/ace-elements.min.js(path=${contextPath})}"></script>
<script th:src="@{{path}/js/ace.min.js(path=${contextPath})}"></script>

<!-- inline scripts related to this page -->
<script th:src="@{{path}/js/add.js(path=${contextPath})}"></script>
<script type="text/javascript">
    $("#submit").click(function () {
        var formDate = new FormData();
        formDate.append("menu", $("#menu").val());
        formDate.append("title", $("#title").val());
        formDate.append("sort", $("#sort").val());
        formDate.append("content", editor.$textElem[0].innerHTML);
        // 提交
        $.ajax({
            type: 'POST',
            url: "save",
            data: formDate,
            processData: false,
            contentType: false,
            cache: false,
            success: function () {
                window.location.href = "list";
            }
        });
    })
</script>
</body>
</html>
